<?php

class Application_Model_DbTable_ItemsJoinCharacter extends Zend_Db_Table_Abstract
{

    protected $_name = 'txy_items_join_character';
    protected $_primary = "id";

    public function getXiuItems($index=2,$limit=8){
    	$select=new Zend_Db_Table_Select($this);
    	$str='is_taobaoke=1 and is_onsale<119 and level0 in("岫玉","岫岩老玉","岫岩河磨玉")';
    	if(0==$index){
    		$str=$str.' and show_level=0';
    	}
    	if(1==$index){
    		$str=$str.' and show_level=1';
    	}
    	$select->from(array('t'=>'txy_items_join_character'),array('t.num_iid','t.title','t.item_url_spell','t.price','t.is_promotion','t.promotion_price','t.promotion_name','t.pic_url','t.freight_payer'))
    		   ->where($str)->order(array('count_num asc','update_time desc'))->limit($limit);
    	$res=$this->fetchAll($select);
    	return $res->toArray();
    }
}

